//引入封装好的axios实例
import http from './index'

//封装大量的接口
/* ===========菜单接口============ */
// 菜单列表的接口
export const menuList = (params) => {
    return http.get('/menulist', {
        params
    })
}

// 菜单添加的接口
export const menuAdd = (data) => {
    return http.post('/menuadd', data)
}

// 菜单修改的接口
export const menuEdit = (data) => {
    return http.post('/menuedit', data)
}

// 菜单删除的接口
export const menuDel = (data) => {
    return http.post('/menudelete', data)
}

// 角色列表的接口
export const roleList = () => {
    return http.get('/rolelist')
}

// 角色添加的接口
export const roleAdd = (data) => {
    return http.post('/roleadd', data)
}

// 角色添加的接口
export const roleEdit = (data) => {
    return http.post('/roleedit', data)
}

// 获取管理员总数
export const getUserCount = () => {
    return http.get('/usercount')
}

// 获取管理员列表
export const getUserList = (params) => {
    return http.get('/userlist', {params})
}

// 管理员添加的接口
export const useAdd = (data) => {
    return http.post('/useradd', data)
}

// 管理员登录的接口
export const login = (data) => {
    return http.post('/userlogin', data)
}

// 获取分类列表
export const getCateList = (params) => {
    return http.get('/catelist', {params})
}

// 管理员登录的接口
export const cateAdd = (data) => {
    return http.post('/cateadd', data)
}

// 商品分类修改的接口
export const cateEdit = (data) => {
    return http.post('/cateedit', data)
}

// 获取商品规格列表的接口
export const getSpecsList = (params) => {
    return http.get('/specslist', {params:params})
}

// 获取商品规格对应的属性值的接口
export const getSpecsInfo = (params) => {
    return http.get('/specsinfo', {params:params})
}

// 获取商品总数的接口
export const getGoodsCount = () => {
    return http.get('/goodscount')
}

// 获取商品列表的接口
export const getGoodsList = (params) => {
    return http.get('/goodslist', {params: params})
}

// 添加商品的接口
export const goodsAdd = (data) => {
    return http.post('/goodsadd', data)
}

// 修改商品的接口
export const goodsEdit = (data) => {
    return http.post('/goodsedit', data)
}